﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Prodcrast
{
    /// <summary>
    /// 
    /// </summary>
    public partial class FeedProperties : Form
    {
        /// <summary>
        /// 
        /// </summary>
        public string FeedName { 
            get { return txtName.Text; }
            set { txtName.Text = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public string FeedURL
        {
            get { return txtURL.Text; }
            set { txtURL.Text = value; }
        }

        /// <summary>
        /// 
        /// </summary>
        public FeedProperties() : this(null)
        {
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="f"></param>
        public FeedProperties(Feed f)
        {
            InitializeComponent(); 
            
            if (f == null)
            {
                txtName.Enabled = false;
                txtURL.Text = "";
            }
            else
            {
                txtName.Text = f.Name;
                txtURL.Text = f.FeedURL;
            }

            DialogResult = DialogResult.Cancel;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            DialogResult = DialogResult.OK;
            Close();
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCancel_Click(object sender, EventArgs e)
        {
            Close();
        }
    }
}
